package cn.haocxy.jfm.file;

import javafx.scene.image.Image;

public final class FileIcons {

	private static final String PREFIX = "/cn/haocxy/jfm/resource/";
	
	public static final double ICONSIZE = 55;

	private static final Image FOLDER = get("folder.png");

	private static final Image FILE = get("file.png");

	private static final Image HTM = get("htm.png");

	private static final Image EXE = get("exe.png");
	
	private static final Image WIN32PART = get("win32part.png");
	
	private static Image get(String name) {
		return new Image(FileIcons.class.getResourceAsStream(PREFIX + name),
				ICONSIZE, ICONSIZE, true, true);
	}
	
	public static Image getIcon(FileType type) {
		if (type.equals(FileType.FOLDER)) {
			return FOLDER;
		}
		if (type.equals(FileType.WIN_PART)) {
			return WIN32PART;
		}
		if (type.equals(FileType.EXE)) {
			return EXE;
		}
		if (type.equals(FileType.HTML)) {
			return HTM;
		}
		return FILE;
	}
}
